package com.znjc.device.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.znjc.device.util.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;

/**
 * 通道转换版
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("iot_tdzhb_data")
public class TdzhbData {
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 数据ids
     */
    private Timestamp ts;
    /**
     * 地址1
     */
    private String dz1;
    /**
     * 地址2
     */
    private String dz2;
    /**
     * 地址3
     */
    private String dz3;
    /**
     * 地址4
     */
    private String dz4;
    /**
     * 地址5
     */
    private String dz5;
    /**
     * 地址6
     */
    private String dz6;
    /**
     * 地址7
     */
    private String dz7;
    /**
     * 地址8
     */
    private String dz8;
    /**
     * 地址9
     */
    private String dz9;
    /**
     * 地址10
     */
    private String dz10;
    @TableField(exist = false)
    private String tsString;

    public String getTsString() {
        try {
            return DateUtil.TimestampToString(this.getTs());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
